package com.zb;

import com.zb.dto.DeviceDTO;
import com.zb.dto.QuotaAllInfo;
import com.zb.emq.EmqClient;
import com.zb.repository.DeviceRepository;
import com.zb.service.TbAlarmService;
import com.zb.util.Pager;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.Date;

@SpringBootApplication
public class YkkApplication {
    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(YkkApplication.class, args);

        TbAlarmService bean = run.getBean(TbAlarmService.class);
//        Pager<QuotaAllInfo> pager = bean.queryAlarmToInflux(1L, 2L, "2025-03-27 00:00:00", "2025-03-27 23:59:59", "温度", "10");
//        System.out.println(pager);

//        bean.connect();
//        bean.publish("mytest","一条测试数据！"+new Date());
//        DeviceDTO deviceDTO = new DeviceDTO();
//        deviceDTO.setDeviceId("1003");
//        deviceDTO.setAlarm(true);
//        deviceDTO.setAlarmName("风速报警");
//        deviceDTO.setLevel(2);
//        deviceDTO.setOnline(true);
//        deviceDTO.setStatus(true);
//        deviceDTO.setTag("交通、航海");

//        DeviceRepository repository = run.getBean(DeviceRepository.class);
//        DeviceDTO deviceById = repository.searchDeviceById("1001");
//        System.out.println(deviceById);
//        repository.addDevice(deviceDTO);
//        PasswordEncoder bean = run.getBean(PasswordEncoder.class);
//        System.out.println(bean.encode("123"));
    }
}
